import json

import requests

# 模拟的浏览器版本
headers = {
    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
}
# 百度翻译的URL
url = 'https://fanyi.baidu.com/sug'
# 要发送的请求体
payload = {
    'kw': 'gucci'
}
r = requests.post(url=url, headers=headers, data=payload)
# 获取为字典
text_dict = json.loads(r.text)
print(type(text_dict))
k = text_dict.get("data")[0].get("k")
v = text_dict.get("data")[0].get("v")
print(k)
print(v)

